//
//  LMSecurity.m
//  FiveStar
//
//  Created by Edward Zhang on 10/29/11.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import "JddSecurity.h"
#import "JddSFHFKeychainUtils.h"

NSString *JddSecurityKey[] = {
    @"Alipay",
    @"Alipay Partner",
    @"Alipay Seller",
    @"Alipay Notify URL",
    @"Alipay Notify URL Test",
    @"Alipay RSA Private Key",
    @"Alipay RSA Public Key"
};

NSString *alipayRsaPrivateKey = @"MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKY4lP5t9tjJzYyHny5D6vahvrIZ6bdTEVX5Fe/c86fdfXPs2lIZ82257FkaKRKVxexGGthEuXcvhx7TUxUiE71tWN7MsfQzr5KMBHUWPZdK6EfXM1/3Ptt25BrYyB6NW+HRP2dm1Msb79Y7tB4VwK58WjUnRTeklaM/hOnbUdF3AgMBAAECgYB/nl+efLUSOtZK9/GaJuEmXIa53TVY4DkmJejW0XBtSJvCPm5crLn+W8n/mxs/vqhIQIbp1tIClQYL/7oBNrmp8HNlWMTNoxUTqF93aBu6f/0806O0AJn+Z4Q0nR33TgXGrUXfDaBs/xcRH1WfszCmOq0xvQ8hUXvE2q8HH3TvCQJBANVWY//0LYWqe47Z942nxIEt/Gc/nahdduu5gLmxvQKb3yDUDOCr8LwqCkvChqk9gxG3Hcymkrrv8T/JFTescksCQQDHdhwgToaCNfV6kB6BvyNK9S5gcndMR9brKKsEJRZpTYR3kOzIsyJ9gU3pbXe7t3L5WJwRBWTzl+VH9wryzQIFAkAtaDbemp05zwB/djsvhl7X0+7eFvc6h7IxGAmi/IarUHvcY+XdyBr0IcqRN3Ur/nCwS5ZnIaknaryhg+4lLGojAkEAmE403ep4RVdkkekYkmRcU7Fyb00YkVPN5ZUROUIEofYCL7anR/2ZWZJx5sujAODs1z91NH4U/vi+qDwYzRwD7QJAPhiRWPrakLmqx6zqVdZ6eHs7BXTvZDcilsNczqqT6WJ5MmmkrGGexkuOBT6oc2li4I0hUp1GT/ma4xcbkCXF2A==";

NSString *alipayRsaPublickKey = @"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHjxQsTdVUi2LwYSwWkNaxnQ444py5QiwoY2KI ynfsLmrZn6wosT9r/telrf6+DsoFR7qBB77D4yDeYlxlxivh77aH8eZjGC7y8NOMKKZOkKBMR/5cn0p9aK/lB4biK+b4D54+Q8k8G/Dd8frEYFPVWy51J53Lc2RPNpUAzRj0MwIDAQAB";

@implementation JddSecurity

+(void)storeSystemData{
    //Alipay相关数据
    [JddSFHFKeychainUtils storeUsername:JddSecurityKey[JDDS_ALIPAY_PARTNER] 
                         andPassword:@"2088301511539624" 
                      forServiceName:JddSecurityKey[JDDS_ALIPAY_SERVICENAME] 
                      updateExisting:YES 
                               error:nil];
    [JddSFHFKeychainUtils storeUsername:JddSecurityKey[JDDS_ALIPAY_SELLER] 
                         andPassword:@"johnson@jiangduoduo.com" 
                      forServiceName:JddSecurityKey[JDDS_ALIPAY_SERVICENAME] 
                      updateExisting:YES 
                               error:nil];
    //首页公告滚动接口
    [JddSFHFKeychainUtils storeUsername:JddSecurityKey[JDDS_ALIPAY_NOTIFY_URL]
                         andPassword:@"http://client.jiangduoduo.com/Mobile/AlipayNotify.aspx" 
                      forServiceName:JddSecurityKey[JDDS_ALIPAY_SERVICENAME] 
                      updateExisting:YES 
                               error:nil];
    [JddSFHFKeychainUtils storeUsername:JddSecurityKey[JDDS_ALIPAY_NOTIFY_URL_TEST] 
                         andPassword:@"http://mobile.jiangduoduo.com/Home/Room/OnlinePay/Alipay02/AlipayNotify.aspx" 
                      forServiceName:JddSecurityKey[JDDS_ALIPAY_SERVICENAME] 
                      updateExisting:YES 
                               error:nil];
    [JddSFHFKeychainUtils storeUsername:JddSecurityKey[JDDS_ALIPAY_RSA_PRIVATE_KEY] 
                         andPassword:alipayRsaPrivateKey 
                      forServiceName:JddSecurityKey[JDDS_ALIPAY_SERVICENAME] 
                      updateExisting:YES
                               error:nil];
    [JddSFHFKeychainUtils storeUsername:JddSecurityKey[JDDS_ALIPAY_RSA_PUBLIC_KEY] 
                         andPassword:alipayRsaPublickKey
                      forServiceName:JddSecurityKey[JDDS_ALIPAY_SERVICENAME] 
                      updateExisting:YES
                               error:nil];
}

+(NSString*)getSystemDataByItemKey:(NSInteger)itemKey serviceNameKey:(NSInteger)serviceNameKey{
    return [JddSFHFKeychainUtils getPasswordForUsername:JddSecurityKey[itemKey] andServiceName:JddSecurityKey[serviceNameKey] error:nil];
}

@end
